package util;

import javax.faces.event.ActionEvent;

import javax.mail.MessagingException;

import oracle.adf.view.rich.component.rich.input.RichInputText;

import system.SystemSecurity;

public class SendMail {
    public SendMail() {
        super();
    }


    public void Send(ActionEvent actionEvent) {
        SystemSecurity obj = new SystemSecurity();
        String displayName = obj.getDisplayName();
        MailImplement mail = new MailImplement();
        String subject = txtSubject.getValue().toString();
        String to = txtTo.getValue().toString();
        String content = txtContent.getValue().toString();

        try {
            mail.sendSSLMessage(to, subject, content, "quannm@tinhvan.com");
        } catch (MessagingException e) {
            System.out.println(e.getMessage());
        }
    }
    
    private RichInputText txtSubject = new RichInputText();
    private RichInputText txtTo = new RichInputText();
    private RichInputText txtContent = new RichInputText();

    public void setTxtSubject(RichInputText txtSubject) {
        this.txtSubject = txtSubject;
    }

    public RichInputText getTxtSubject() {
        return txtSubject;
    }

    public void setTxtTo(RichInputText txtTo) {
        this.txtTo = txtTo;
    }

    public RichInputText getTxtTo() {
        return txtTo;
    }

    public void setTxtContent(RichInputText txtContent) {
        this.txtContent = txtContent;
    }

    public RichInputText getTxtContent() {
        return txtContent;
    }
}
